package day021.junit;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class CalculatorTest {

    Calculator cal = null;

    @Before
    public void setUp() throws Exception {
        cal = new Calculator();
    }

    @Test
    public void add() {
        int res = cal.add(1, 2);
        Assert.assertEquals(3, res);
    }

    @Test
    public void testAdd() {
        cal.add(3);
        Assert.assertEquals(3, cal.getResult());
    }

    @Test(timeout = 2000)
    public void squareRoot() {
        cal.squareRoot(16);
    }
}